package com.software.levelupandroid.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.util.Log;

public class TokenUtil {
    private static SharedPreferences sharedPreferences;
    public static void saveToken(String token,Context context){
        sharedPreferences = context.getSharedPreferences("token",Context.MODE_PRIVATE);
        sharedPreferences.edit()
                .putString("token",token)
                .apply();
        Log.i("TokenUtils", "saveToken: "+token);
    }
    public static String getToken(Context context){
        sharedPreferences = context.getSharedPreferences("token",Context.MODE_PRIVATE);
        String token = sharedPreferences.getString("token", null);
        Log.i("TokenUtils", "getToken: "+token);
        return "level-up "+token;
    }
}
